function xcdy(ao, a, b, c, d, e) {
	this.ao = ao;
	this.a = a;
	this.b = b;
	this.c = c;
	this.d = d;
	this.e = e;
	this.num = 1;
	this.caa = 1;
	this.timenum = [500, 100, 200];
	this.bdxs = 1;
}

xcdy.prototype = {
	constructor: xcdy,
	clac:function(){
		return (this.timenum[0] - this.timenum[1] - this.timenum[2]) * this.bdxs;
	},
	one: function(x, y) {
		var o = this;
		this.ao.play();
		x.addClass("active");
		y.removeClass("active");
		setTimeout(function () {
			o.show();
		}, this.timenum[0]*this.bdxs);
	},
	three: function(x) {
		var o = this;
		this.ao.play();
		x.addClass("active");
		setTimeout(function() {
			if(o.caa != 3) {
				x.removeClass("active");
			}
			setTimeout(function() {
				if(o.caa == 3) {
					o.caa = 1;
					setTimeout(function () {
						o.show();
					}, o.clac());
				} else {
					o.three(x);
					o.caa++;
				}
			}, o.timenum[1]*o.bdxs);
		}, o.timenum[2]*o.bdxs);
	},
	show: function() {
		if(this.e) switch(this.num) {
			case 1:
				this.one(this.a, this.d);
				this.num++;
				break;
			case 2:
				this.one(this.b, this.a);
				this.num++;
				break;
			case 3:
				this.b.removeClass("active");
				this.three(this.c);
				this.bdxs = 0.9;
				this.num++;
				break;
			case 4:
				this.one(this.d, this.c);
				this.num++;
				break;
			case 5:
				this.one(this.a, this.d);
				this.num++;
				break;
			case 6:
				this.a.removeClass("active");
				this.three(this.b);
				this.bdxs = 0.7;
				this.num++;
				break;
			case 7:
				this.one(this.c, this.b);
				this.num++;
				break;
			case 8:
				this.one(this.d, this.c);
				this.num++;
				break;
			case 9:
				this.d.removeClass("active");
				this.three(this.a);
				this.bdxs = 0.5;
				this.num++;
				break;
			case 10:
				this.one(this.b, this.a);
				this.num++;
				break;
			case 11:
				this.one(this.c, this.b);
				this.num++;
				break;
			case 12:
				this.c.removeClass("active");
				this.three(this.d);
				this.bdxs = 1;
				this.num = 1;
				break;
			default:
				break;
		} else if(this.c) switch(this.num) {
			case 1:
				this.one(this.a, this.d);
				this.num++;
				break;
			case 2:
				this.one(this.b, this.a);
				this.num++;
				break;
			case 3:
				this.b.removeClass("active");
				this.three(this.c);
				this.num++;
				break;
			case 4:
				this.one(this.d, this.c);
				this.num++;
				break;
			case 5:
				this.one(this.a, this.d);
				this.num++;
				break;
			case 6:
				this.a.removeClass("active");
				this.three(this.b);
				this.num++;
				break;
			case 7:
				this.one(this.c, this.b);
				this.num++;
				break;
			case 8:
				this.one(this.d, this.c);
				this.num++;
				break;
			case 9:
				this.d.removeClass("active");
				this.three(this.a);
				this.num++;
				break;
			case 10:
				this.one(this.b, this.a);
				this.num++;
				break;
			case 11:
				this.one(this.c, this.b);
				this.num++;
				break;
			case 12:
				this.c.removeClass("active");
				this.three(this.d);
				this.num = 1;
				break;
			default:
				break;
		} else switch(this.num) {
			case 1:
				this.one(this.a, this.b);
				this.num++;
				break;
			case 2:
				this.one(this.b, this.a);
				this.num++;
				break;
			case 3:
				this.b.removeClass("active");
				this.three(this.a);
				this.num++;
				break;
			case 4:
				this.one(this.b, this.a);
				this.num++;
				break;
			case 5:
				this.one(this.a, this.b);
				this.num++;
				break;
			case 6:
				this.a.removeClass("active");
				this.three(this.b);
				this.num = 1;
				break;
			default:
				break;
		}
	}
}